<template>
  <div>
    <h2 v-text="msg" ref="title"></h2>
    <button @click="showDom" ref="btn">点我输出DOM元素</button>
    <School ref="sch"/>
  </div>
</template>

<script>
    import School from './components/School.vue'
    export default {
        name: 'App',
        data(){
            return{
                msg:"欢迎新同学"
            }
        },
        methods:{
            showDom(){
                console.log(this.$refs.title)//真实dom元素
                console.log(this.$refs.btn)//真实dom元素
                console.log(this.$refs.sch)//子组件的实例对象
            }
        },
        components: { School },

    }
</script>
